package com.eduhzy.ttw.teacher.mvp.model.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.mcxtzhang.indexlib.IndexBar.bean.BaseIndexPinyinBean;

/**
 * @author xubo
 * @date 2018/7/18 16:58
 */
public class ChildAreaData extends BaseIndexPinyinBean implements Parcelable {
    private String areaCode;
    private String areaName;
    private boolean isTop;//是否是最上面的 不需要被转化成拼音的
    private boolean showCount;

    public boolean isShowCount() {
        return showCount;
    }

    public ChildAreaData setShowCount(boolean showCount) {
        this.showCount = showCount;
        return this;
    }

    public boolean isTop() {
        return isTop;
    }

    public ChildAreaData setTop(boolean top) {
        isTop = top;
        return this;
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    public ChildAreaData() {
    }

    public ChildAreaData(String areaName) {
        this.areaName = areaName;
    }

    @Override
    public String getTarget() {
        return areaName;
    }

    @Override
    public boolean isNeedToPinyin() {
        return !isTop;
    }


    @Override
    public boolean isShowSuspension() {
        return !isTop;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.areaCode);
        dest.writeString(this.areaName);
        dest.writeByte(this.isTop ? (byte) 1 : (byte) 0);
        dest.writeByte(this.showCount ? (byte) 1 : (byte) 0);
    }

    protected ChildAreaData(Parcel in) {
        this.areaCode = in.readString();
        this.areaName = in.readString();
        this.isTop = in.readByte() != 0;
        this.showCount = in.readByte() != 0;
    }

    public static final Creator<ChildAreaData> CREATOR = new Creator<ChildAreaData>() {
        @Override
        public ChildAreaData createFromParcel(Parcel source) {
            return new ChildAreaData(source);
        }

        @Override
        public ChildAreaData[] newArray(int size) {
            return new ChildAreaData[size];
        }
    };
}
